package com.itheima.map;

import java.util.TreeMap;

public class Demo5 {
    public static void main(String[] args) {
        String s = "aababcabcdabcde";
        TreeMap<Character,Integer> t = new TreeMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if(!t.containsKey(c)){
                t.put(c,1);
            }else{
                Integer count = t.get(c);
                count++;
                t.put(c,count);
            }
        }
        t.forEach((ca,in)-> System.out.print(ca+"("+in+")"));
    }
}
